<template>
	<u-popup :show="open" @close="popupClose" @open="popupOpen" mode="bottom" :closeable="false" :closeOnClickOverlay="true">
		<!-- <view class="blank20"></view> -->
		<u-line></u-line>
		<template v-if="data && data.exchangeDish && data.exchangeDish.dish && !disabled.doExchange">
			<view class="flex">
				 <view class="action-item" style="padding-left:15px;"  @click="bind('doExchange')">
					 <text>与</text>
					 <text class="text-primary ml10 mr15">[ {{data.exchangeDish.dinner_type_name}}-{{data.exchangeDish.dish_top_category_name}}-{{data.exchangeDish.dish[1]}} ]</text>
					 <text>交换</text>
				 </view>
			</view>
			<u-line></u-line>
		</template>
		<!-- 与。。。交换 -->
		<view class="flex">
			<view class="flex-1 action-item text-green" :class="disabled.look?'disabled':''" @click="bind('look')">
				查看
			</view>
			<view class="flex-1 action-item text-primary" :class="disabled.edit?'disabled':''" @click="bind('edit')">
				修改
			</view>
			<view class="flex-1 action-item" :class="disabled.copy?'disabled':''" @click="bind('copy')">
				复制
			</view>
			<view class="flex-1 action-item" :class="disabled.paste?'disabled':''" @click="bind('paste')">
				粘贴
			</view>
			<view class="flex-1 action-item" :class="disabled.exchange?'disabled':''" @click="bind('exchange')">
				交换
			</view>
			<view class="flex-1 action-item text-red" :class="disabled.del?'disabled':''" @click="bind('del')">
				清空
			</view>
		</view>
		<view class="flex bg-gray">
			<view class="flex-1 action-item" @click="bind('addUpRow')">
				向上新增一行
			</view>
			<view class="flex-1 action-item text-red" @click="bind('delRow')">
				删除本行
			</view>
			<view class="flex-1 action-item" @click="bind('addDownRow')">
				向下新增一行
			</view>
		</view>	
	</u-popup>
</template>

<script>
	export default {
		name: "dish-edit-popup",
		props: {
			data: Object,
			open:Boolean,
			disabled:Object
		},
		data() {
			return {

			};
		},
		methods: {
			popupClose(){
				// this.open = false;
				this.$emit("close");
			},
			popupOpen(){
				
			},
			bind(t){
				if(this.disabled[t]){
					return;
				}
				this.$emit("bind",t);
			}
			
		}
	}
</script>

<style>
	.action-item{
		padding: 8px 0;
		text-align: center;
		font-weight: bolder;
	}
	.action-item.disabled{
		color: #999999 !important;
		font-weight:normal
	}
</style>